# encoding:utf-8
"""
账号相关sql
"""
# 登录查询
SearchUserByUserIdPwdSQL = "SELECT * FROM MCCP_UserInfo WHERE  UserID ='{UserID}' AND  UserPwd ='{UserPwd}'"

SearchAllUserSql = "SELECT * FROM MCCP_UserInfo "

# 执行用户权限查询
SearchAllUsersStoreHandleSql = """
DECLARE	@return_value int
    EXEC	@return_value = [dbo].[SearchUserAll]
            @RoleID = N'{RoleID}'
    SELECT	'Return Value' = @return_value
"""
# 执行用户的品牌、门店存储查询
SearchUserBrandStoreSQL = """
DECLARE	@return_value int
    EXEC	@return_value = [dbo].[MCCP_SearchOnlyBrandandStore]
            @UserID = N'{UserID}'
    SELECT	'Return Value' = @return_value
"""
# 查询用户手机数据设置
SearchUserPhoneSettingSQL = """
SELECT * FROM MCCP_ST_PhoneSettings WHERE  UserID='{UserID}'
"""
# 插入用户手机看数据设置
InsertUserPhoneSettingSQL = """
INSERT INTO MCCP_ST_PhoneSettings
           ([YNAbnormal]
           ,[YNVerification]
           ,[YNLogon]
           ,[YNBusiness]
           ,[UserID])
     VALUES
           ({YNAbnormal},
           {YNVerification},
           {YNLogon},
           {YNBusiness},
           {UserID})
"""

# 更新设置
UpdateUserPhoneSettingSQL = """
UPDATE MCCP_ST_PhoneSettings
   SET YNAbnormal = {YNAbnormal},
   YNVerification = {YNVerification},
   YNLogon = {YNLogon},
   YNBusiness = {YNBusiness}
 WHERE UserID = '{UserID}'
"""

# 更新用户OpenID
UpdateUserOpenIdSQL = """
UPDATE MCCP_UserInfo
   SET OpenID = {OpenID}
 WHERE UserID='{UserID}'
"""

# 会员充值情况
UserRechargeTotalSQL = """
SELECT * FROM MCCP_ST_TST_MerberTopUpRecord
 WHERE StoreID='{StoreID}' AND RecentlyTime>='{DayStartTime}' and RecentlyTime<='{DayEndTime}'
"""
# 员工提成

EmployeeCommissionSQL = """
SELECT * FROM T_ReportStoreHandleProductOrderDetails
WHERE  StoreID='{StoreID}'

"""
